package util;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

public class SaveProperty {
    /**
     * 自动保存成Properties
     * @param path 保存文件的路径
     * @param ppt 传入的property
     */
    public static void storeProperty(String path, Properties ppt){
        FileOutputStream fos = null;
        try {
            fos=new FileOutputStream(path);
            ppt.store(fos,null);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
